package com.cjkj.system.api.factory;

import com.cjkj.common.core.domain.R;
import com.cjkj.common.core.domain.runset.RunSetParam;
import com.cjkj.system.api.RemoteTJ03Service;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

@Slf4j
@Component
public class RemoteTJ03ServiceFallbackFactory implements FallbackFactory<RemoteTJ03Service> {

    @Override
    public RemoteTJ03Service create(Throwable cause) {
        log.error("系统服务调用失败:{}", cause.getMessage());
        return new RemoteTJ03Service() {
            @Override
            public R<Object> sendCommand(String equipmentNo, RunSetParam runSet, String source) {
                return R.fail("设备命令发送失败！");
            }
        };
    }

}
